Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Percolate API : Highlight on sub-field issue #4348

Closed
pdesoyres opened this issue Dec 5, 2013 · 1 comment
Closed

Percolate API : Highlight on sub-field issue #4348

pdesoyres opened this issue Dec 5, 2013 · 1 comment
Assignees

Comments

@pdesoyres
Copy link

Highlight is not done on sub-field of an object field when using Percolate API (1.0.0.Beta2) :

create index :

 curl -XPUT "http://localhost:9200/test-index"

create a mapping with a field "content" containing two sub-fields (which are stored)

 curl -XPUT "http://localhost:9200/test-index/test-mapping/_mapping" -d'
 {"test-mapping":
     {
         "properties": {
             "content" : {
                 "properties": {
                     "message": {"type": "string","store": "yes"},
                     "lang": {"type": "string","store": "yes"}
                 }
             }
         }
     }
 }'

index query into .percolator :

 curl -XPUT "http://localhost:9200/test-index/.percolator/q1" -d'
 {
     "query" : {
         "term" : {
             "content.message" : "bonsai"
         }
     }
 }'

use Percolate API with highlight on content.message field :

 curl -XPOST "http://localhost:9200/test-index/test-mapping/_percolate" -d'
 {
     "size":10,
     "highlight": {
         "fields": {"content.message":{}}
     },
     "doc" : {
         "content": {
             "message": "bonsai tree office",
             "lang": "en"
         }
     }
 }'

result doesn't show highlight :

 {
    "took": 3,
    "_shards": {
       "total": 5,
       "successful": 5,
       "failed": 0
    },
    "total": 1,
    "matches": [
       {
          "_index": "test-index",
          "_id": "q1",
          "highlight": {}
       }
    ]
 }
@ghost ghost assigned martijnvg Dec 7, 2013
@martijnvg
Copy link
Member

Thanks for reporting this! This bug doesn't seem to be caused by the fact that content is a subfield, but that this field is stored separately in the mapping ("store" : "yes").

martijnvg added a commit to martijnvg/elasticsearch that referenced this issue Dec 13, 2013
…of the _source even if there are stored fields.

The percolator uses this option to deal with the fact that the MemoryIndex doesn't support stored fields,
this is possible b/c the _source of the document being percolated is always present.

Closes elastic#4348
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants